<!DOCTYPE html>
<html lang="zh-cn">

<head>
<meta charset="utf-8" />
<meta name="author" content="TianShangXing" />
<meta name="description" content="Personal blog." />
<meta name="keywords" content="blog, tech" />
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="generator" content="Hugo 0.68.3" />

<link rel="canonical" href="https://tianshangxing.gitee.io/myblog/blog/django/">
<meta property="og:title" content="Django" />
<meta property="og:description" content="Django Django是一个开放源代码的Web应用框架，由Python写成。采用了MVT的软件设计模式，即模型（Model），视图（View）和模板（Template）。
安装依赖 pip install Django==2.0.4 pip install django-cors-headers pip install djangorestframework pip install PyMySQL pip install opencv-python pip install opencv-contrib-python pip install numpy pip install pillow pip install dwebsocket 依赖文件生成 requirements.txt pip freeze &gt; requirements.txt 依赖文件安装 requirements.txt pip install -r requirements.txt 新建Django项目 django-admin startproject mydjango 新建子应用 python manage.py startapp myapp 数据库迁移 python manage.py makemigrations myapp python manage.py migrate 反向迁移 python manage.py inspectdb &gt; mymodels.py 启动项目 python manage.py runserver 项目仓库： https://github." />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://tianshangxing.gitee.io/myblog/blog/django/" />
<meta property="article:published_time" content="2020-04-22T17:11:46+08:00" />
<meta property="article:modified_time" content="2020-04-22T17:11:46+08:00" />

<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Django"/>
<meta name="twitter:description" content="Django Django是一个开放源代码的Web应用框架，由Python写成。采用了MVT的软件设计模式，即模型（Model），视图（View）和模板（Template）。
安装依赖 pip install Django==2.0.4 pip install django-cors-headers pip install djangorestframework pip install PyMySQL pip install opencv-python pip install opencv-contrib-python pip install numpy pip install pillow pip install dwebsocket 依赖文件生成 requirements.txt pip freeze &gt; requirements.txt 依赖文件安装 requirements.txt pip install -r requirements.txt 新建Django项目 django-admin startproject mydjango 新建子应用 python manage.py startapp myapp 数据库迁移 python manage.py makemigrations myapp python manage.py migrate 反向迁移 python manage.py inspectdb &gt; mymodels.py 启动项目 python manage.py runserver 项目仓库： https://github."/>


<meta itemprop="name" content="Django">
<meta itemprop="description" content="Django Django是一个开放源代码的Web应用框架，由Python写成。采用了MVT的软件设计模式，即模型（Model），视图（View）和模板（Template）。
安装依赖 pip install Django==2.0.4 pip install django-cors-headers pip install djangorestframework pip install PyMySQL pip install opencv-python pip install opencv-contrib-python pip install numpy pip install pillow pip install dwebsocket 依赖文件生成 requirements.txt pip freeze &gt; requirements.txt 依赖文件安装 requirements.txt pip install -r requirements.txt 新建Django项目 django-admin startproject mydjango 新建子应用 python manage.py startapp myapp 数据库迁移 python manage.py makemigrations myapp python manage.py migrate 反向迁移 python manage.py inspectdb &gt; mymodels.py 启动项目 python manage.py runserver 项目仓库： https://github.">
<meta itemprop="datePublished" content="2020-04-22T17:11:46&#43;08:00" />
<meta itemprop="dateModified" content="2020-04-22T17:11:46&#43;08:00" />
<meta itemprop="wordCount" content="71">



<meta itemprop="keywords" content="" />

<link rel="stylesheet" href="https://tianshangxing.gitee.io/myblog/css/layout.css" />


<link rel="stylesheet" href="https://tianshangxing.gitee.io/myblog/css/default-dark.css" />




<title>


     Django 

</title>

</head>


<body>
<div class="main">
<header>

<div class="header-bar">

  <nav>
    <div class="siteTitle">
      <a href="https://tianshangxing.gitee.io/myblog">TianShangXing&#39;s Blog</a>
    </div> 

    
    
    <a class="nav-item" href="https://tianshangxing.gitee.io/myblog/blog/"><div class="nav-item-title">Blogs</div></a>
    
    <a class="nav-item" href="https://tianshangxing.gitee.io/myblog/resume/"><div class="nav-item-title">Resume</div></a>
    

  </nav>

  
<div class="social-links-header">

  
  <a href="mailto:tian_shang_xing@foxmail.com"><div class="social-link">email</div></a>
  

  
  <a href="https://github.com/TianShangXing" target="_blank"><div class="social-link">gh</div></a>
  

  

  

  
  <a href="https://www.linkedin.com/in/%e6%98%9f%e4%bc%b8-%e5%88%98-b7b7321a6" target="_blank"><div class="social-link">in</div></a>
  

</div>


</div>


</header>


<article class="post">
    <h1 class="title"> Django </h1>
    <div class="content"> <h3 id="django">Django</h3>
<p><strong>Django</strong>是一个开放源代码的Web应用框架，由Python写成。采用了MVT的软件设计模式，即模型（Model），视图（View）和模板（Template）。</p>
<h3 id="安装依赖">安装依赖</h3>
<pre><code>pip install Django==2.0.4

pip install django-cors-headers

pip install djangorestframework

pip install PyMySQL

pip install opencv-python

pip install opencv-contrib-python

pip install numpy

pip install pillow

pip install dwebsocket
</code></pre><h3 id="依赖文件生成-requirementstxt">依赖文件生成 requirements.txt</h3>
<pre><code>pip freeze &gt; requirements.txt
</code></pre><h3 id="依赖文件安装-requirementstxt">依赖文件安装 requirements.txt</h3>
<pre><code>pip install -r requirements.txt
</code></pre><h3 id="新建django项目">新建Django项目</h3>
<pre><code>django-admin startproject mydjango
</code></pre><h3 id="新建子应用">新建子应用</h3>
<pre><code>python manage.py startapp myapp
</code></pre><h3 id="数据库迁移">数据库迁移</h3>
<pre><code>python manage.py makemigrations myapp

python manage.py migrate
</code></pre><h3 id="反向迁移">反向迁移</h3>
<pre><code>python manage.py inspectdb &gt; mymodels.py
</code></pre><h3 id="启动项目">启动项目</h3>
<pre><code>python manage.py runserver
</code></pre><p>项目仓库： <a href="https://github.com/TianShangXing/mydjango">https://github.com/TianShangXing/mydjango</a></p>
 </div>
    <footer class="post-footer">

  <div class="post-footer-data">
            
<div class="tags">
  
</div>

    <div class="date"> 2020-04-22 </div>
    
  </div>
</footer>



</article>

  <footer>

  <div class="social-links-footer">

  
  <a href="mailto:tian_shang_xing@foxmail.com"><div class="social-link">Email</div></a>
  

  
  <a href="https://github.com/TianShangXing" target="_blank"><div class="social-link">GitHub</div></a>
  

  

  

  
  <a href="https://www.linkedin.com/in/%e6%98%9f%e4%bc%b8-%e5%88%98-b7b7321a6" target="_blank"><div class="social-link">LinkedIn</div></a>
  

  <div class="social-link">
  <a href="https://tianshangxing.gitee.io/myblog/index.xml" target="_blank">RSS</a>
  </div>

</div>


  <div class="copyright"> Copyright (c) 2020, all rights reserved. </div>

  <div class="poweredby">
    Powered by <a href="https://gohugo.io/">Hugo</a>.
  </div>

  </footer>

</div> 

</body>
</html>

